<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head >
    <title>添加关键词</title>
    <link rel="stylesheet" href="/layui/css/layui.css">
    <script src="/layui/layui.js"></script>
    <script>
        var index = 0;
        try{
            index = parent.layer.getFrameIndex(window.name); //获取窗口索引
        }catch (e) {
        }
    </script>
</head>
<body >

<div class="layui-body" style="padding-top: 20px;">

    <div class="sp-wrapper">
        <div class="order-body">

            <form method="post" class="layui-form" id="sp-form">

                <div class="layui-form-item">
                    <label class="layui-form-label">平台：</label>
                    <div class="layui-input-block">
                        <input type="radio" name="platform" value="TAO" title="淘宝" >
                        <input type="radio" name="platform" value="PDD" title="拼多多" checked>
                        <input type="radio" name="platform" value="DOU" title="抖音" >
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">类目：</label>
                    <div class="layui-inline" >
                        <select name="category" >
                            <option value="牛仔裤" selected>牛仔裤</option>
                            <option value="休闲裤">休闲裤</option>
                        </select>
                        </div>
                        <div class="layui-inline" >
                        <select name="category2" id="category2" lay-verify="required">
                            <option value="">子类目</option>
                            <option value="未分类">未分类</option>
                            <option th:each="item:${categoryList}" th:value="${item.name}" th:text="${item.name}"></option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">关键词</label>
                    <div class="layui-inline">
                        <input type="text" name="keyword" lay-verify="required" placeholder="关键词" autocomplete="off" class="layui-input">
                    </div>
                <!-- </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">来源</label> -->
                    <div class="layui-inline">
                        <select name="source" lay-verify="required">
                            <option value="" >来源</option>
                            <option value="APP搜索框" >APP搜索框</option>
                            <option value="营销中心-市场工具" >营销中心-市场工具</option>
                            <option value="第三方工具" >第三方工具</option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">备注</label>
                    <div class="layui-inline">
                        <input type="text" name="remark" placeholder="备注" autocomplete="off" class="layui-input">
                    </div>
                    <div class="layui-inline">
                        <input type="text" name="include_date" id="include_date" lay-verify="required" readonly placeholder="收录日期" autocomplete="off" class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">热度</label>
                    <div class="layui-input-inline">
                        <input type="text" name="sousuoredu" placeholder="搜索热度" lay-verify="required|number"  autocomplete="off" class="layui-input">
                    </div>
                    <div class="layui-input-inline">
                        <input type="text" name="dianjiredu" placeholder="点击热度" lay-verify="required|number" autocomplete="off" class="layui-input">
                    </div>
                   
                </div>
                
                <div class="layui-form-item">
                    <label class="layui-form-label">转化</label>
                    <div class="layui-input-inline">
                        <input type="text" name="dianjilv" lay-verify="required|number" placeholder="点击率" autocomplete="off" class="layui-input">
                    </div>
                    <div class="layui-input-inline">
                        <input type="text" name="zhifulv" lay-verify="required|number" placeholder="支付转化率" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">市场</label>
                    <div class="layui-inline">
                        <input type="text" name="jingzhengzhishu"  placeholder="竞争指数" autocomplete="off" style="width: 100px;" class="layui-input">
                    </div>
                
                    <div class="layui-inline">
                        <input type="text" name="chengjiaozhishu" placeholder="成交指数" autocomplete="off" style="width: 100px;" class="layui-input">
                    </div>
                
                    <div class="layui-inline">
                        <input type="text" name="shichangchujia"  placeholder="市场平均出价" autocomplete="off" style="width: 150px;"  class="layui-input">
                    </div>
                </div>




                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit lay-filter="add_btn">立即提交</button>
                        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                    </div>
                </div>
            </form>
        </div>
    <script type="text/javascript" src="/sb/jquery.min.js"></script>
    <script type="text/javascript" src="/sb/Tips.min.js"></script>

    <!-- end sp-wrapper -->
    <script>
        layui.use(['laydate', 'form','layer'], function () {
            var laydate = layui.laydate;
            var form = layui.form;
            var layer = layui.layer;

            //执行一个laydate实例
            laydate.render({
                elem: '#include_date' //指定元素
            });

            form.on('submit(add_btn)', function(data){
                console.log(data.field);
                $.ajax({
                    type:"POST",
                    url:"/ecom/goods_keyword_add_ajax",
                    processData: false, //表明不要对数据进行处理
                    data:JSON.stringify(data.field),
                    contentType: 'application/json',
                    success:function (res) {
                        if(res.code == 0){
                            parent.layer.msg(res.msg)
                            parent.layer.close(index);
                            parent.location.reload();
                        }else {
                            layer.msg(res.msg)
                        }
                        return false;
                    }
                });
                return false;
            });
        });

    </script>
      </div>
    </div>
</div>
</body>
<html>
